﻿using UnityEngine;
using System.Collections;
using Map_Sys;
using Building_Sys;
using Solider_Sys;
public class Data_Ref : MonoBehaviour {
	public static Player_Choice player_choice_comp;
	public static GameObject[] building_prefabs;
	public static GameObject[] solider_prefabs;
	public static GameObject[] map_prefabs;
	public static TextAsset[]  map_data;
	public static GameObject[] terrain_prefabs;
	public static readonly Vector3 vector3_up = Vector3.up;
	public static readonly Vector3 vector3_down = -Vector3.up;
	public static readonly Vector3 vector3_left = -Vector3.right;
	public static readonly Vector3 vector3_right = Vector3.right;
	public static readonly Vector3 vector3_nw = Vector3.Normalize(new Vector3(-1,1,0));
	public static readonly Vector3 vector3_ne = Vector3.Normalize(new Vector3(1,1,0));
	public static readonly Vector3 vector3_se = -vector3_nw;
	public static readonly Vector3 vector3_sw = -vector3_ne;
	public static readonly float SOLIDER_ATTACK_INTERVAL_MIN = 0.1f;//Ê¿±ø×îÐ¡¹¥»÷ŒäžôÊ±Œä£šÃë£©
	public static readonly float SOLIDER_MOVE_SPEED_MIN = 0;//Ê¿±ø×îÐ¡ÒÆ¶¯ËÙ¶È
	public static readonly float LAST_ATTACK_TIME_INITIAL = -10000;//³õÊŒÉÏŽÎ¹¥»÷Ê±Œä
	
	public static readonly float SOLIDER_ATTACK_RANGE_MIN = 1.0f;//Ê¿±ø×îÐ¡¹¥»÷·¶Î§
	public static readonly float SOLIDER_VISUAL_RANGE_MIN = 1.0f;//Ê¿±ø×îÐ¡ÊÓÒ°
	
    void Awake()
	{
		DontDestroyOnLoad(this);
		FindRefInScene();
	}
	
	void FindRefInScene()
	{
		
		Player_Choice player_choice_comp = GameObject.Find("/DataRef/PlayerChoice").GetComponent<Player_Choice>();
		building_prefabs = GameObject.Find("/DataRef/BuildingPrefabs").GetComponent<Building_Prefabs>().building_prefabs;
		solider_prefabs = GameObject.Find("/DataRef/SoliderPrefabs").GetComponent<Solider_Prefabs>().solider_prefabs;
		terrain_prefabs = GameObject.Find("/DataRef/TerrainPrefabs").GetComponent<Terrain_Prefabs>().terrain_prefabs;
		map_prefabs = GameObject.Find("/DataRef/MapPrefabs").GetComponent<Map_Prefabs>().map_prefabs;
	    map_data = GameObject.Find("/DataRef/MapPrefabs").GetComponent<Map_Prefabs>().map_data;
	}
}
